from django.db import models

# Create your models here.

GenderChoices = [
    (1, "Male"),
    (2, "Female")
]


class Student(models.Model):
    class Meta:
        db_table = "student"
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=16, verbose_name="学生姓名")
    age = models.SmallIntegerField(verbose_name="学生年龄")
    gender = models.IntegerField(choices=GenderChoices, verbose_name="学生性别")


class Score(models.Model):
    id = models.AutoField(primary_key=True)
    class_name = models.CharField(max_length=16, verbose_name="课程名称")
    class_score = models.SmallIntegerField(verbose_name="分数")
    student = models.ForeignKey(verbose_name="分数对应的学生", to="Student", on_delete=models.CASCADE)
